import java.util.Scanner;
import java.util.Stack;

public class Test1 {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        Stack<String> stack = new Stack<>() ;
        for(int i = 0 ; i < str.length() ; i ++){
            if(str.charAt(i) != ' '){
                int start = i ;
                int end = i ;
                while( end < str.length() && str.charAt(end) != ' '){
                    end ++ ;
                }
                String tmp = str.substring(start , end);
                stack.push(tmp) ;
                i = end ;
            }
        }
        while(!stack.empty()){
            String tmp = stack.pop() ;
            if(stack.size() >= 1){
                System.out.print(tmp+" ") ;
            }else{
                System.out.print(tmp) ;
            }

        }


    }

}

